<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Promise类方法</title>
</head>

<body>
    <script>
        // Promise.resolve("执行成功").then((value)=>{
        //     console.log(value);
        // })

        let promise1 = new Promise((resolve, reject) => {
            resolve("成功执行p1");
        })
        let promise2 = new Promise((resolve, reject) => {
            resolve("成功执行p2");
        })
        let promise3 = new Promise((resolve, reject) => {
            //  resolve("执行成功p3");
            reject("p3执行失败");
        })

        // Promise.all([promise1,promise2,promise3]).then((res)=>{
        //     console.log(res);
        // }).catch((res)=>{
        //     console.log(res);
        // })

        Promise.allSettled([promise1, promise2, promise3]).then((res) => {
            console.log(res);
            for (let i = 0; i < res.length; i++) {
                console.log(res[i].reason);
            }
        }).catch((res) => {
            console.log(res);
        })
    </script>
</body>

</html>